var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    priceObj:{}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getData()
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },
  getData(){
    let url= 'api/shopr/shopOilInfo';
    let that = this;
    app.post({
      url:url,
      data:{
        shop_id:wx.getStorageSync('shop_id')
      },
      success:e=>{
        let res = e.data.data.info;
        console.log(res)
        this.setData({
          priceObj:res
        })
      }
    })
  },
  setprice: function (e) {
    console.log(e)
    var shopid = wx.getStorageSync('shop_id');
    let params = e.detail.value;
    for(let k in params){
      if(!params[k]){
        wx.showToast({
          title: '请将价格信息补充完整',
          icon: 'none'
        })
        return
      }
    }
    params.shop_id = shopid
    app.post({
      url: 'api/shopr/addOilReview',
      data: params,
      success: function (res) {
        console.log(res);
        wx.showToast({
          title: res.data.msg,
          icon: 'none'
        })
        if (res.data.code == 1) {
          setTimeout(function () {
            wx.navigateBack({
              delta: 1
            })
          }, 2000)
        }
      }
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

})